package com.hc.sp02.item.service;

import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import sp01.pojo.Item;
import sp01.service.ItemService;

import java.util.ArrayList;
import java.util.List;

/**
 * @author He
 * @date 2021/8/30 14:41
 */
@Service
@Slf4j
public class ItemServiceImpl implements ItemService {
    @Override
    public List<Item> getItems(String orderId) {
        List<Item> list = new ArrayList<>();
        list.add(new Item(1, "商品1", 1));
        list.add(new Item(2, "商品2", 6));
        list.add(new Item(3, "商品3", 3));
        list.add(new Item(4, "商品4", 5));
        list.add(new Item(5, "商品5", 7));
        list.add(new Item(6, "商品6", 2));
        return list;
    }

    @Override
    public void decreaseNumbers(List<Item> list) {
        for (Item item : list) {
            log.info("减少商品库存：" + item);
        }
    }
}
